const express = require('express');
const router = new express.Router();

/**
 * @param {Object} options
 * @param {} options.code 编号
 * @param {} options.name 名称
 * @param {} options.pageSize 每页数据量
 * @param {} options.pageIndex 指定页
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/', async(req, res, next) => {
    const options = {
        code: req.query.code,
        name: req.query.name,
        pageSize: req.query.pageSize,
        pageIndex: req.query.pageIndex,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id358',
                    code: 'code359',
                    name: 'name360',
                    description: 'description',
                    partCategoryId: 'partCategoryId',
                    partCategoryCode: 'partCategoryCode',
                    partCategoryName: 'partCategoryName',
                    rowVersion: 'rowVersion',
                    userDefinedAssistPartDetails: [{
                        id: 'id111',
                        claimPrice: 1,
                        dealerId: 'dealerId',
                        productCategoryId: 'productCategoryId',
                        engineCode: 'engineCode',
                        transmissionSn: 'transmissionSn',
                        singleQty: 1,
                        maxQty: 10
                    }],
                    options: [
                        'update'
                    ]
                },
                {
                    id: 'id361',
                    code: 'code362',
                    name: 'name363',
                    description: 'description',
                    partCategoryId: 'partCategoryId',
                    partCategoryCode: 'partCategoryCode',
                    partCategoryName: 'partCategoryName',
                    rowVersion: 'rowVersion',
                    userDefinedAssistPartDetails: [{
                        id: 'id111',
                        claimPrice: 1,
                        dealerId: 'dealerId',
                        productCategoryId: 'productCategoryId',
                        engineCode: 'engineCode',
                        transmissionSn: 'transmissionSn',
                        singleQty: 1,
                        maxQty: 10
                    }],
                    options: [
                        'update'
                    ]
                }
            ]
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @throws {Error}
 * @return {Promise}
 */
router.post('/', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: '新增'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id 自定义辅料Id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: '修改'
    };
    res.json(data);
});
router.get('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message',
        payload: {
            id: 'id358',
            code: 'code359',
            name: 'name360',
            description: 'description',
            partCategoryId: 'partCategoryId',
            partCategoryCode: 'partCategoryCode',
            partCategoryName: 'partCategoryName',
            rowVersion: 'rowVersion',
            userDefinedAssistPartDetails: [{
                id: 'id111',
                claimPrice: 1,
                dealerId: 'dealerId',
                dealerCode: 'dealerCode',
                dealerName: 'dealerName',
                productCategoryId: 'productCategoryId',
                productCategoryCode: 'productCategoryCode',
                productCategoryName: 'productCategoryName',
                engineCode: 'engineCode',
                transmissionSn: 'transmissionSn',
                singleQty: 1,
                maxQty: 10
            }]
        }
    };
    res.json(data);
});
module.exports = router;
